package com.cpit.qualitycontrol.service;

import com.cpit.platform.common.entity.TableDataQueryCondition;
import com.cpit.platform.common.entity.TableJsonData;
import com.cpit.qualitycontrol.entity.WorkOrder;
import com.cpit.qualitycontrol.vo.ImportWorkOrderVo;
import com.cpit.qualitycontrol.vo.SubTaskCreateVo;
import com.cpit.qualitycontrol.vo.WorkOrderCreateVo;

import java.util.List;

/**
 * Created by xxx on 2017/10/1.
 */
public interface WorkOrderService {

    /**
     * 创建工单
     *
     * @param workOrderCreateVo
     * @return 创建的工单集合
     * @throws Exception
     */
    List<WorkOrder> createWorkOrder(Integer createUserId, WorkOrderCreateVo workOrderCreateVo) throws Exception;


    /**
     * 创建工单，根据 excel
     *
     * @param importWorkOrderVoList
     * @return
     * @throws Exception
     */
    List<WorkOrder> createWorkOrderByExcel(Integer createUserId, List<ImportWorkOrderVo> importWorkOrderVoList) throws Exception;

    /**
     * 创建工单，导入用
     * @param createUserId
     * @param subTaskCreateVoList
     * @param deviceId
     * @return
     * @throws Exception
     */
    WorkOrder createWorkOrderOneDevice(Integer createUserId,
                                       List<SubTaskCreateVo> subTaskCreateVoList, String deviceId) throws Exception;
//    /**
//     * 认领任务
//     * @param userId
//     * @param taskDefinitionKey
//     * @param processInstanceBusinessKey
//     * @throws Exception
//     */
//    void claim(Integer userId, String taskDefinitionKey,
//               String processInstanceBusinessKey) throws Exception;


    void assignWorkOrders(Integer assignUserId, List<Long> workOrderIds) throws Exception;

    /**
     * 根据userid 查询未分派工单
     *
     * @param userId
     * @param page
     * @param size
     * @param order
     * @param orderBy
     * @param productLineId
     * @param projectName
     * @param constructionTeamName
     * @param deviceName
     * @param deviceTypeId
     * @param workOrderState
     * @return
     */
    List<WorkOrder> queryNotAssignWorkOrderByUserId(Integer userId,
                                                    int page,
                                                    int size,
                                                    String order,
                                                    String orderBy,
                                                    Long productLineId,
                                                    String projectName,
                                                    String constructionTeamName,
                                                    String deviceName,
                                                    Long deviceTypeId,
                                                    Integer workOrderState);

    /**
     * 查询工单
     *
     * @param userId
     * @param page
     * @param size
     * @param order
     * @param orderBy
     * @param productLineId
     * @param projectName
     * @param constructionTeamName
     * @param deviceName
     * @param deviceTypeId
     * @param workOrderState
     * @return
     */
    List<WorkOrder> queryWorkOrder(Integer userId,
                                   int page,
                                   int size,
                                   String order,
                                   String orderBy,
                                   Long productLineId,
                                   String projectName,
                                   String constructionTeamName,
                                   String deviceName,
                                   Long deviceTypeId,
                                   Integer workOrderState,
                                   String addr);


    TableJsonData findNotAssignWorkOrderByConditionJqg(Integer userId, TableDataQueryCondition cond);

    TableJsonData findWorkOrderByConditionJqg(Integer userId, TableDataQueryCondition cond, Boolean isNotAssign);

    List<WorkOrder> queryWorkOrder(Integer userId,
                                   Long productLineId,
                                   String projectName,
                                   String constructionTeamName,
                                   String deviceName,
                                   Long deviceTypeId,
                                   Integer workOrderState);

    WorkOrder getWorkOrderById(Long workOrderId);

    List<WorkOrder> findAll();
}
